<?php
header('Content-Type:application/json;charset=utf-8');

require_once 'php/config.php';
require_once 'php/function.php';
require_once 'php/class/sql.class.php';
require_once 'php/class/cache.class.php';
require_once 'php/class/authcode.class.php';
require_once 'php/common.php';

extract($_REQUEST);

$result = array();

if (!isset($m) || trim($m) === '')
	$m = 'index';
if (!isset($c) || trim($c) === '')
	$c = 'index';

$module = MODULE_PATH . "{$m}.class.php";
if (file_exists($module)) {
	require_once $module;
	$conclass = preg_replace('/^.*\//', '', $m) . '_controller';
	$common   = new $conclass();
	$isLogin  = $common->isLogin();
	
	if ($m !== 'login' && true !== $isLogin)
		$result = $isLogin;
	else
		$result = is_callable(array(
			$common,
			$c
		)) ? $common->$c() : msg(-1, '非法请求！');
} else
	$result = msg(-2, '非法操作！');

exit(json($result));